package oop.ex3.nameserver.actions;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;

import oop.ex3.messages.FileMessage;
import oop.ex3.messages.MessageInterface;

import oop.ex3.nameserver.NSContext;
import oop.ex3.sockets.ClientSocket;

public class AddFile extends NsAction {
	
	public AddFile(NSContext context){
		super(context);
	}

	@Override
	public boolean run(ClientSocket socket, MessageInterface msg) {
		_context.addFile(((FileMessage)msg).getFileName()
				, socket.getOtherPeer());
		return sendDone(socket);
	}

}
